<div class="pa">
  <h2>个人中心</h2>
  <hr class="tl"/>
  <div class="clearfix">
    <div class="span-4 colborder mh-35">
      <%= render 'users/sidebar' %>
    </div>
    <div class="span-18 last">
      <h3>我的订单</h3>
      <hr/>
      <table>
        <tr>
          <th>Id</th>
          <th>订单明细</th>
          <th>金额</th>
          <th>类型</th>
          <th>状态</th>
          <th>时间</th>
        </tr>
        <% @deals.each do |deal| %>
          <tr>
            <td><%= deal.id %></td>
            <td>
              <ul>
                <% deal.orders.each do |order| %>
                  <li><%= link_to order.product.name, "products/show/#{order.product.id}", :target => '_blank' %> - <%= order.product.price %>元 × <%= order.discount/10 %>（折扣） × <%= order.number %>份 </li>
                <% end %>
              </ul>
            </td>
            <td><%= deal.amount %> 元</td>
            <td><%= deal_kind deal.kind %></td>
            <td><%= deal_status deal.status %></td>
            <td><%= deal.created_at.strftime('%Y-%m-%d') %></td>
          </tr>
        <% end %>
      </table>
    </div>
  </div>
</div>